#собесы #python #senior Вопросы, которые могут задать на собеседовании Senior Python Developer. Проверьте себя без помощи поисковиков!
❓Что такое __slots__ и зачем он нужен?
Пример кода:
class MyClass: __slots__ = ['x', 'y']
obj = MyClass() obj.x = 10 obj.y = 20 # obj.z = 30 # Ошибка: нельзя добавить новый атрибут
❗️__slots__ — это атрибут класса, который ограничивает набор атрибутов экземпляра. Он используется для экономии памяти, так как предотвращает создание словаря __dict__ для каждого экземпляра. Однако это ограничивает гибкость, например, добавление новых атрибутов динамически.
#собесы #python #senior Вопросы, которые могут задать на собеседовании Senior Python Developer. Проверьте себя без помощи поисковиков!
❓Что такое __slots__ и зачем он нужен?
Пример кода:
class MyClass: __slots__ = ['x', 'y']
obj = MyClass() obj.x = 10 obj.y = 20 # obj.z = 30 # Ошибка: нельзя добавить новый атрибут
❗️__slots__ — это атрибут класса, который ограничивает набор атрибутов экземпляра. Он используется для экономии памяти, так как предотвращает создание словаря __dict__ для каждого экземпляра. Однако это ограничивает гибкость, например, добавление новых атрибутов динамически.
Bitcoin mining is the process of adding new transactions to the Bitcoin blockchain. It’s a tough job. People who choose to mine Bitcoin use a process called proof of work, deploying computers in a race to solve mathematical puzzles that verify transactions.To entice miners to keep racing to solve the puzzles and support the overall system, the Bitcoin code rewards miners with new Bitcoins. “This is how new coins are created” and new transactions are added to the blockchain, says Okoro.
Dump Scam in Leaked Telegram Chat
A leaked Telegram discussion by 50 so-called crypto influencers has exposed the extraordinary steps they take in order to profit on the back off unsuspecting defi investors. According to a leaked screenshot of the chat, an elaborate plan to defraud defi investors using the worthless “$Few” tokens had been hatched. $Few tokens would be airdropped to some of the influencers who in turn promoted these to unsuspecting followers on Twitter.